﻿﻿
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="<s:url value="/assets/web/css/base.css"></s:url>">
    <link rel="stylesheet" href="<s:url value="/assets/web/css/login/bootstrap.min.css?v=3.3.6"></s:url>">
    <!-- 基本框css -->
    <link rel="stylesheet" href="<s:url value="/assets/web/css/base_nav.css"></s:url>">
    <!-- 项目管理Css -->
    <link rel="stylesheet" href="<s:url value="/assets/web/css/user/user_xmProject.css"></s:url>">
    <title>项目管理</title>
    <style>
        .hidden {
            display: none;
        }

        #myModal-search .form-group:after {
            content: '';
            display: block;
            clear: both;
        }

        .authority{
            display: none;
        }

    </style>
</head>

<body class="bgcolor">
<%@ include file="/WEB-INF/views/modules/commons/nav.jsp" %>
<%@ include file="/WEB-INF/views/modules/commons/menu.jsp" %>
<table></table>
<div id="content-main" class="av row J_mainContent">
    <div class="user-project-manger">
        <div class="container" style="position: relative;">
            <div class="search-project">
                <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal-search">条件搜索</button>
            </div>
            <ul class="project-btn">
                <li class="primary" id="allProject">全部项目</li>
                <li class="pending" id="pass">已审核项目</li>
                <li class="finished-task" id="noPass">未审核项目</li>
                <li id="stop-task">暂停项目</li>
                <li id="status" style="display: none;"></li>
                <li id="pages" style="display: none;"></li>
            </ul>
        </div>
        <div class="container">
            <table class="project-info">
                <thead>
                <tr>
                    <th>项目名称</th>
                    <th>责任单位</th>
                    <th>分管领导</th>
                    <th>状态</th>
                    <th>&nbsp;</th>
                    <th>&nbsp;&nbsp;&nbsp;操作</th>
                    <th>&nbsp;</th>
                </tr>
                </thead>
                <tbody id="index-main">
                </tbody>
            </table>
        </div>
        <!-- 分页 -->
        <div class="footer">
            <ul class="pagination" id="pagination0"></ul>
        </div>

    </div>

</div>

<!-- 搜索模态框（Modal） -->
<div class="modal fade" id="myModal-search" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title">
                   搜索项目
                </h4>
            </div>
            <form action="">
                <div class="modal-body text-center">
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">项目名称</label>
                        <div class="col-sm-4">
                            <input type="text" name="projectName" class="form-control project-name1">
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">责任单位</label>
                        <div class="col-sm-4">
                            <input type="text" name="projectResdept" class="form-control  project-resdept1">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">分管领导</label>
                        <div class="col-sm-4">
                            <input type="text" name="projectRole" class="form-control project-role1">
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">分管领导手机号</label>
                        <div class="col-sm-4">
                            <input type="text" name="projectrolephone" class="form-control  project-rolePhone1">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">项目联系人</label>
                        <div class="col-sm-4">
                            <input type="text" name="contactName" class="form-control contact-name1">
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">项目联系人手机号</label>
                        <div class="col-sm-4">
                            <input type="text" name="contactPhone" class="form-control contact-phone1">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">项目责任人</label>
                        <div class="col-sm-4">
                            <input type="text" name="OwnerUnitPerson" class="form-control OwnerUnit-person1">
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">项目责任人手机号</label>
                        <div class="col-sm-4">
                            <input type="text" name="OwnerUnitPersonPhone" class="form-control OwnerUnit-personPhone1">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">计划投资总额(万)</label>
                        <div class="col-sm-4">
                            <input type="text" name="projectMoney" class="form-control project-money1">
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">初步选址</label>
                        <div class="col-sm-4">
                            <input type="text" name="projectAddress" class="form-control  project-address1">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">建设内容</label>
                        <div class="col-sm-4">
                            <input type="text" name="projectDescribes" class="form-control project-describes1">
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">行业分类</label>
                        <div class="col-sm-4">
                            <select name="industryType" id="industryType1" class="form-control industry-type">
                                <option value=""></option>
                                <option value="1001">旅游特色小镇项目</option>
                                <option value="1002">工业项目</option>
                                <option value="1003">交通</option>
                                <option value="1004">城镇基础设施</option>
                                <option value="1005">安置房项目</option>
                                <option value="1006">社会事业项目</option>
                                <option value="1007">商住项目</option>
                                <option value="1008">农林水利环保生态项目</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">进度分类</label>
                        <div class="col-sm-4">
                            <select name="schedCode" id="schedCode1" class="form-control sched-code">
                                <option value=""></option>
                                <option value="3001">前期项目</option>
                                <option value="3002">开工项目</option>
                                <option value="3003">在建提速</option>
                                <option value="3004">竣工项目</option>
                            </select>
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">项目分类</label>
                        <div class="col-sm-4">
                            <select name="projectType" id="projectType1" class="form-control project-type">
                                <option value=""></option>
                                <option value="2001">计划新开工项目</option>
                                <option value="2002">结转项目</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">征迁实施单位</label>
                        <div class="col-sm-4">
                            <input type="text" id="occupyDept1" name="occupyDept" class="form-control">
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">征迁责任人</label>
                        <div class="col-sm-4">
                            <input type="text" id="occupyResUser1" name="occupyResUser" class="form-control ">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">征迁责任人手机号</label>
                        <div class="col-sm-4">
                            <input type="text" id="occupyResUserPhone1" name="occupyResUserPhone" class="form-control">
                        </div>
                        <label class="col-sm-2 control-label no-padding-right">征迁经办人</label>
                        <div class="col-sm-4">
                            <input type="text" id="occupyOperateUser1" name="occupyOperateUser" class="form-control ">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label no-padding-right">征迁经办人手机号</label>
                        <div class="col-sm-4">
                            <input type="text" id="occupyOperateUserPhone1" name="occupyOperateUserPhone"
                                   class="form-control">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="search">搜索</button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<%--通不通过模态框--%>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <%--确认通过--%>
    <div class="modal-dialog  through-or-no-1">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" style="text-align: center;">确认该项目通过吗？</h4>
            </div>
            <div class="modal-footer" id="passY">
                <form role="form" action="<s:url value="/projectManger/pass"></s:url>">
                    <input type="text" class="sysid" name="sysId" placeholder="" style="display: none">
                    <button type="submit" class="btn btn-primary">确认</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
    <%--不通过--%>
    <div class="modal-dialog  through-or-no-2">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" style="text-align: center;">确认该项目不能通过吗？</h4>
            </div>
            <div class="modal-footer" id="passN">
                <form role="form" action="<s:url value="/projectManger/noPass"></s:url>">
                    <input type="text" class="sysid" name="sysId" placeholder="" style="display: none">
                    <button type="submit" class="btn btn-primary">确认</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</div>
<%--修改模态框--%>
<div class="modal fade" id="myModal-update" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <p class="node-title" style="display: inline-block;font-size: 20px;font-weight: bold; margin: 0;"></p>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <div class="module-node-name">
                    <p>项目名称</p>
                    <p>责任单位</p>
                    <p>分管领导</p>
                    <p>分管领导手机号</p>
                    <p>项目联系人</p>
                    <p>项目联系人手机号</p>
                    <p>项目责任人</p>
                    <p>项目责任人手机号</p>
                    <p>计划投资总额(万)</p>
                    <p>初步选址</p>
                    <%--<p>行业类型</p>--%>
                    <p>建设内容</p>
                    <p>行业分类</p>
                    <p>进度分类</p>
                    <p>项目分类</p>
                    <p>征迁实施单位</p>
                    <p>征迁责任人</p>
                    <p>征迁责任人手机号</p>
                    <p>征迁经办人</p>
                    <p>征迁经办人手机号</p>
                </div>
            </div>
            <form action="">
                <div class="modal-body text-center">
                    <div class="div-input">
                        <input name="projectName" class="project-name" type="text">
                    </div>
                    <div class="div-input">
                        <input name="projectResdept" class="project-resdept" type="text">
                    </div>
                    <div class="div-input">
                        <input name="projectRole" class="project-role" type="text">
                    </div>
                    <div class="div-input">
                        <input name="projectrolephone" class="project-rolePhone" type="text">
                    </div>
                    <div class="div-input">
                        <input name="contactName" class="contact-name" type="text">
                    </div>
                    <div class="div-input">
                        <input name="contactPhone" class="contact-phone" type="text">
                    </div>
                    <div class="div-input">
                        <input name="OwnerUnitPerson" class="OwnerUnit-person" type="text">
                    </div>
                    <div class="div-input">
                        <input name="OwnerUnitPersonPhone" class="OwnerUnit-personPhone" type="text">
                    </div>
                    <div class="div-input">
                        <input name="projectMoney" class="project-money" type="text">
                    </div>
                    <div class="div-input">
                        <input name="projectAddress" class="project-address" type="text">
                    </div>
                    <%-- <div class="div-input">
                          <input name="natureType" class="nature-type" type="text">
                      </div>--%>
                    <div class="div-input">
                        <input name="projectDescribes" class="project-describes" type="text">
                    </div>
                    <div class="div-input">
                        <select name="industryType" class="industry-type" type="text" id="industryType">
                            <option value="1001">旅游特色小镇项目</option>
                            <option value="1002">工业项目</option>
                            <option value="1003">交通</option>
                            <option value="1004">城镇基础设施</option>
                            <option value="1005">安置房项目</option>
                            <option value="1006">社会事业项目</option>
                            <option value="1007">商住项目</option>
                            <option value="1008">农林水利环保生态项目</option>
                        </select>
                    </div>
                    <div class="div-input">
                        <select name="schedCode" class="sched-code" type="text" id="schedCode">
                            <option value="3001">前期项目</option>
                            <option value="3002">开工项目</option>
                            <option value="3003">在建提速</option>
                            <option value="3004">竣工项目</option>
                        </select>
                    </div>
                    <div class="div-input">
                        <select name="projectType" class="project-type" type="text" id="projectType">
                            <option value="2001">计划新开工项目</option>
                            <option value="2002">结转项目</option>
                        </select>
                    </div>
                    <div class="div-input">
                        <input id="occupyDept" name="occupyDept" type="text">
                    </div>
                    <div class="div-input">
                        <input id="occupyResUser" name="occupyResUser" type="text">
                    </div>
                    <div class="div-input">
                        <input id="occupyResUserPhone" name="occupyResUserPhone" type="text">
                    </div>
                    <div class="div-input">
                        <input id="occupyOperateUser" name="occupyOperateUser" type="text">
                    </div>
                    <div class="div-input">
                        <input id="occupyOperateUserPhone" name="occupyOperateUserPhone" type="text">
                    </div>
                </div>
                <input class="project-id" hidden name="" type="text">
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="sub">提交更改</button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

</div>

<script src="<s:url value="/assets/web/js/jquery.min.js?v=2.1.4"></s:url>"></script>
<script src="<s:url value="/assets/web/js/bootstrap.min.js"></s:url>"></script>
<script src="<s:url value="/assets/web/js/jqpaginator.min.js"></s:url>"></script>

<script src="<s:url value="/assets/web/common/bootstrapvalidator/dist/js/bootstrapValidator.js"></s:url>"
<%--项目管理js--%>
<script src="<s:url value="/assets/web/js/user/user_xmProject.js"></s:url>"></script>
<script>
    $(function () {
        //用户角色类型
        var branchType = "${branchType}";

        //分页
        $('#pagination0').jqPaginator({
            totalPages: ${totalPage},
            visiblePages: 5,
            currentPage: 1,
            first: '<li class="first"><a href="javascript:void(0);">首页</a></li>',
            prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
            next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
            last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
            page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
            onPageChange: function (num) {
                $('#text').html('当前第' + num + '页');
                //获取状态值
                var status = $("#status").text();
                var val = $("#search-input").val();
                $.ajax({
                    type: "GET",
                    url: "/projectManger/query",
                    dataType: "json",
                    data: {page: num - 1},
                    success: function (data) {
                        console.log(data);
                        var html = "";
                        for (var i = 0; i < data.list.length; i++) {
                            var list = data.list[i];
                            //行业分类
                            var industryType = list.industryType == "1001" ? "旅游特色小镇项目" : list.industryType == "1002" ? "工业项目" : list.industryType == "1003" ? "交通" : list.industryType == "1004" ? "城镇基础设施" : list.industryType == "1005" ? "安置房项目" : list.industryType == "1006" ? "社会事业项目" : list.industryType == "1007" ? "商住项目" : list.industryType == "1008" ? "农林水利环保生态项目" : "";
                            //进度分类
                            var schedCode = list.schedCode == "3001" ? "前期项目" : list.schedCode == "3002" ? "开工项目" : list.schedCode == "3003" ? "在建提速" : list.schedCode == "3004" ? "竣工项目" : "";
                            //项目分类
                            var projectType = list.projectType == "2001" ? "计划新开工项目" : list.projectType == "2002" ? "结转项目" : "";
                            var hiddenBtn = (list.status) == 3 ? '' : (list.status) == 6 ? '' : 'hidden';
                            html += '\
                                 <tr>\
                        <td style="display: none">' + list.sysId + '</td>\
                        <td>' + (list.name == undefined ? "" : list.name) + '</td>\
                        <td>' + (list.resDept == undefined ? "" : list.resDept) + '</td>\
                        <td>' + (list.resUser == undefined ? "" : list.resUser) + '</td>\
                        <td>' + (list.status == 2 ? "未审核" : list.status == 3 ? "审核通过" : list.status == 4 ? "项目已完成" : list.status == 6 ? "暂停" : "未确定") + '</td>\
                        <td class="lookNode">\
                            <a href="/projectManger/queryNode?sysId=' + list.sysId + '">查看项目</a>\
                        </td>\
                        <td class="authority"><button class="update-button" data-id="' + list.sysId + '" data-name="' + list.name + '" data-resDept="' + list.resDept + '" data-resUser="' + list.resUser + '" data-resPhone="' + list.resPhone + '" data-money="' + list.money + '" data-address="' + list.address + '" data-describes="' + list.describes + '" data-contactName="' + list.contactName + '" data-contactPhone="' + list.contactPhone + '" data-OwnerUnitPerson="' + list.ownerUnitPerson + '" data-OwnerUnitPersonPhone="' + list.ownerUnitPersonPhone + '" data-natureType="' + list.natureType + '" data-industryType="' + industryType + '" data-schedCode="' + schedCode + '" data-projectType="' + projectType + '" data-toggle="modal" data-target="#myModal-update" data-occupydept=' + list.occupyDept + ' data-occupyoperateuser=' + list.occupyOperateUser + ' data-occupyresuser=' + list.occupyResUser + ' data-occupyresuserphone=' + list.occupyResUserPhone + ' data-occupyoperateuserphone=' + list.occupyOperateUserPhone + '>修改</button></td>\
                        <td>\
                             <span class="through" data-sysId="' + list.sysId + '" data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "通过") + '</span>\
                            ' + (list.status >= 3 ? " " : "|") + '\
                            <span class="no-through" data-sysId="' + list.sysId + '"  data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "不通过") + '</span>\
                        </td>\
                         <td class="authority"><button class="stopProject  ' + hiddenBtn + ' "  data-id="' + list.sysId + '">' + (list.status == 6 ? "开始" : list.status == 3 ? "暂停" : "") + '</button></td>\
                    </tr>\
                    ';
                        }

                        $("#index-main").html(html);
                        var numbers = $("#industryType").find("option"); //绑定select下拉框的值
                        for (var j = 0; j < numbers.length; j++) {
                            if ($(numbers[j]).val() == industryType) {
                                $(numbers[j]).prop("selected", "selected");
                            }
                        }

                        window.setTimeout(authorityFunc, 500);

                    },
                    error: function () {
                        console.log("发生错误");
                    }
                });
            }
        });

        // 修改项目信息  获取自定义值时要用小写
        $("#index-main").on("click", ".update-button", function () {
            var projecid = $(this).data("id"); //项目id
            $(".project-id").val(projecid);

            var projectname = $(this).data("name"); //项目名称
            $(".project-name").val(projectname);

            var projectresdept = $(this).data("resdept"); //责任单位
            $(".project-resdept").val(projectresdept);

            var projectrole = $(this).data("resuser"); //分管领导
            $(".project-role").val(projectrole);

            var projectrolephone = $(this).data("resphone"); //分管领导手机号
            $(".project-rolePhone").val(projectrolephone);

            var contactname = $(this).data("contactname"); //项目联系人
            $(".contact-name").val(contactname);

            var contactphone = $(this).data("contactphone"); //项目联系人手机号
            $(".contact-phone").val(contactphone);

            var OwnerUnitPerson = $(this).data("ownerunitperson"); //项目责任人
            $(".OwnerUnit-person").val(OwnerUnitPerson);

            var OwnerUnitPersonPhone = $(this).data("ownerunitpersonphone"); //项目责任人手机号
            $(".OwnerUnit-personPhone").val(OwnerUnitPersonPhone);

            var projectmoney = $(this).data("money"); //计划投资总额
            $(".project-money").val(projectmoney);

            var projectaddress = $(this).data("address"); //初步选址
            $(".project-address").val(projectaddress);

            var projectdescribes = $(this).data("describes"); //建设内容
            $(".project-describes").val(projectdescribes);

            var industryTypes = $(this).data("industrytype"); //行业分类
            var opsIndustryType = $("#industryType>option");
            console.log(industryTypes);
            for (var i = 0; i < opsIndustryType.length; i++) {
                if (opsIndustryType[i].innerHTML == industryTypes) {
                    opsIndustryType[i].setAttribute("selected", "true");
                } else {
                    opsIndustryType[i].removeAttribute("selected");
                }
            }

            var schedcode = $(this).data("schedcode"); //进度分类
            var opsschedcode = $("#schedCode>option");
            console.log(schedcode);
            for (var i = 0; i < opsschedcode.length; i++) {
                if (opsschedcode[i].innerHTML == schedcode) {
                    opsschedcode[i].setAttribute("selected", "true");
                } else {
                    opsschedcode[i].removeAttribute("selected");
                }
            }

            var projectTypes = $(this).data("projecttype"); //项目分类
            var opsprojectType = $("#projectType>option");
            console.log(projectTypes);
            for (var i = 0; i < opsprojectType.length; i++) {
                if (opsprojectType[i].innerHTML == projectTypes) {
                    opsprojectType[i].setAttribute("selected", "true");
                } else {
                    opsprojectType[i].removeAttribute("selected");
                }
            }

            var occupydept = $(this).data("occupydept"); //征迁实施单位
            if (isEmpty(occupydept)) {
                $("#occupyDept").val("");
            } else {
                $("#occupyDept").val(occupydept);
            }
            var occupyresuser = $(this).data("occupyresuser"); //征迁责任人
            if (isEmpty(occupyresuser)) {
                $("#occupyResUser").val("");
            } else {
                $("#occupyResUser").val(occupyresuser);
            }
            var occupyresuserphone = $(this).data("occupyresuserphone"); //征迁责任人手机号
            if (isEmpty(occupyresuserphone)) {
                $("#occupyResUserPhone").val("");
            } else {
                $("#occupyResUserPhone").val(occupyresuserphone);
            }
            var occupyoperateuser = $(this).data("occupyoperateuser"); //征迁经办人
            if (isEmpty(occupyoperateuser)) {
                $("#occupyOperateUser").val("");
            } else {
                $("#occupyOperateUser").val(occupyoperateuser);
            }
            var occupyoperateuserphone = $(this).data("occupyoperateuserphone"); //征迁经办人手机号
            if (isEmpty(occupyoperateuserphone)) {
                $("#occupyOperateUserPhone").val("");
            } else {
                $("#occupyOperateUserPhone").val(occupyoperateuserphone);
            }
        })

        $("#sub").click(function () {
            var id = $(".project-id").val();
            var name = $(".project-name").val();
            var resDept = $(".project-resdept").val();
            var resUser = $(".project-role").val();
            var resPhone = $(".project-rolePhone").val();
            var contactName = $(".contact-name").val();
            var contactPhone = $(".contact-phone").val();
            var OwnerUnitPerson = $(".OwnerUnit-person").val();
            var OwnerUnitPersonPhone = $(".OwnerUnit-personPhone").val();
            var address = $(".project-address").val();
            var money = $(".project-money").val();
            var describes = $(".project-describes").val();
            var natureType = $(".nature-type").val();
            var industryType = $("#industryType  option:selected").val();
            var schedCode = $("#schedCode  option:selected").val();
            var projectType = $("#projectType  option:selected").val();
            var occupyDept = $("#occupyDept").val();
            var occupyResUser = $("#occupyResUser").val();
            var occupyOperateUser = $("#occupyOperateUser").val();
            var occupyResUserPhone = $("#occupyResUserPhone").val();
            var occupyOperateUserPhone = $("#occupyOperateUserPhone").val();
            var postdata = {
                "sysId":id,
                "name": name,
                "resDept": resDept,
                "resUser": resUser,
                "resPhone": resPhone,
                "contactName": contactName,
                "contactPhone": contactPhone,
                "ownerUnitPerson": OwnerUnitPerson,
                "ownerUnitPersonPhone": OwnerUnitPersonPhone,
                "money": money,
                "address": address,
                "describes": describes,
                "natureType": natureType,
                "industryType": industryType,
                "schedCode": schedCode,
                "projectType": projectType,
                "occupyDept": occupyDept,
                "occupyResUser": occupyResUser,
                "occupyOperateUser": occupyOperateUser,
                "occupyResUserPhone": occupyResUserPhone,
                "occupyOperateUserPhone": occupyOperateUserPhone
            };
            $.ajax({
                type: "post",
                url: "/projects/editProjectInfo",
                dataType: "json",
                data: JSON.stringify(postdata),
                contentType: 'application/json;charset=utf-8',
                success: function (data) {
                    if (data.code == '200') {
                        alert("更新成功");
                        location.reload();
                    } else if (res.code == '500') {
                        alert("更新失败," + res.message);
                    }
                },
                error: function (res) {
                }
            })
            console.log(postdata);
        });

        //全部项目点击事件
        $("#allProject").click(function () {
            window.location.reload();
        })

        //已经审核项目点击事件
        $("#pass").click(function () {
            $("#status").text("3");
            $('#pagination0').jqPaginator({
                totalPages: 1,
                visiblePages: 5,
                currentPage: 1,
                first: '<li class="first"><a href="javascript:void(0);">首页</a></li>',
                prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
                next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
                last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
                page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
                onPageChange: function (num) {
                    $('#text').html('当前第' + num + '页');
                    //获取状态值
                    var status = $("#status").text();
                    var val = $("#search-input").val();
                    $.ajax({
                        type: "GET",
                        url: "/projectManger/query",
                        dataType: "json",
                        data: {page: num - 1, status: 3},
                        success: function (datas) {
                            var html = "";
                            for (var i = 0; i < datas.list.length; i++) {
                                var list = datas.list[i];
                                var hiddenBtn = (list.status) == 3 ? '' : (list.status) == 6 ? '' : 'hidden';
                                html += '\
                                 <tr>\
                        <td style="display: none">' + list.sysId + '</td>\
                        <td>' + list.name + '</td>\
                        <td>' + list.resDept + '</td>\
                        <td>' + list.resUser + '</td>\
                        <td>' + (list.status == 2 ? "未审核" : list.status == 3 ? "审核通过" : list.status == 4 ? "项目已完成" : list.status == 6 ? "暂停" : "未确定") + '</td>\
                        <td class="lookNode">\
                            <a href="/projectManger/queryNode?sysId=' + list.sysId + '">查看项目</a>\
                        </td>\
                        <td class="authority"><button class="update-button" data-id="' + list.sysId + '" data-name="' + list.name + '" data-resDept="' + list.resDept + '" data-resUser="' + list.resUser + '" data-resPhone="' + list.resPhone + '" data-money="' + list.money + '" data-address="' + list.address + '" data-describes="' + list.describes + '" data-contactName="' + list.contactName + '" data-contactPhone="' + list.contactPhone + '" data-OwnerUnitPerson="' + list.ownerUnitPerson + '" data-OwnerUnitPersonPhone="' + list.ownerUnitPersonPhone + '" data-natureType="' + list.natureType + '" data-industryType="' + industryType + '" data-schedCode="' + schedCode + '" data-projectType="' + projectType + '" data-toggle="modal" data-target="#myModal-update" data-occupydept=' + list.occupyDept + ' data-occupyoperateuser=' + list.occupyOperateUser + ' data-occupyresuser=' + list.occupyResUser + ' data-occupyresuserphone=' + list.occupyResUserPhone + ' data-occupyoperateuserphone=' + list.occupyOperateUserPhone + '>修改</button></td>\
                        <td>\
                            <span class="through" data-sysId="' + list.sysId + '" data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "通过") + '</span>\
                            ' + (list.status >= 3 ? " " : "|") + '\
                            <span class="no-through" data-sysId="' + list.sysId + '"  data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "不通过") + '</span>\
                        </td>\
                        <td class="authority"><button class="stopProject"  data-id="' + list.sysId + '">' + (list.status == 6 ? "开始" : list.status == 3 ? "暂停" : "") + '</button></td>>\
                    </tr>';
                            }
                            $("#index-main").html(html);
                            //赋值总页数
                            $("#pages").html(datas.totalPage);
                            pagg = Number($("#pages").html());
                            //调用分页插件修改查询总页数
                            $('#pagination0').jqPaginator('option', {
                                totalPages: pagg,
                            });

                            window.setTimeout(authorityFunc, 500);

                        },
                        error: function () {
                            console.log("发生错误");
                        }
                    });
                }
            });
            window.setTimeout(authorityFunc, 500);
        })

        //未审核项目点击事件
        $("#noPass").click(function () {
            $("#status").text("5");
            $('#pagination0').jqPaginator({
                totalPages: 1,
                visiblePages: 5,
                currentPage: 1,
                first: '<li class="first"><a href="javascript:void(0);">首页</a></li>',
                prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
                next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
                last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
                page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
                onPageChange: function (num) {
                    $('#text').html('当前第' + num + '页');
                    //获取状态值
                    var status = $("#status").text();
                    var val = $("#search-input").val();
                    $.ajax({
                        type: "GET",
                        url: "/projectManger/query",
                        dataType: "json",
                        data: {page: num - 1, status: 5},
                        success: function (datas) {
                            console.log(datas);
                            var html = "";
                            for (var i = 0; i < datas.list.length; i++) {
                                var list = datas.list[i];
                                var hiddenBtn = (list.status) == 3 ? '' : (list.status) == 6 ? '' : 'hidden';
                                html += '\
                                 <tr>\
                        <td style="display: none">' + list.sysId + '</td>\
                        <td>' + list.name + '</td>\
                        <td>' + list.resDept + '</td>\
                        <td>' + (list.resUser == undefined ? "" : list.resUser) + '</td>\
                        <td>' + (list.status == 2 ? "未审核" : list.status == 3 ? "审核通过" : list.status == 4 ? "项目已完成" : list.status == 6 ? "暂停" : "未确定") + '</td>\
                        <td class="lookNode">\
                            <a href="/projectManger/queryNode?sysId=' + list.sysId + '">查看项目</a>\
                        </td>\
                        <td class="authority"><button class="update-button" data-id="' + list.sysId + '" data-name="' + list.name + '" data-resDept="' + list.resDept + '" data-resUser="' + list.resUser + '" data-resPhone="' + list.resPhone + '" data-money="' + list.money + '" data-address="' + list.address + '" data-describes="' + list.describes + '" data-contactName="' + list.contactName + '" data-contactPhone="' + list.contactPhone + '" data-OwnerUnitPerson="' + list.ownerUnitPerson + '" data-OwnerUnitPersonPhone="' + list.ownerUnitPersonPhone + '" data-natureType="' + list.natureType + '" data-industryType="' + industryType + '" data-schedCode="' + schedCode + '" data-projectType="' + projectType + '" data-toggle="modal" data-target="#myModal-update" data-occupydept=' + list.occupyDept + ' data-occupyoperateuser=' + list.occupyOperateUser + ' data-occupyresuser=' + list.occupyResUser + ' data-occupyresuserphone=' + list.occupyResUserPhone + ' data-occupyoperateuserphone=' + list.occupyOperateUserPhone + '>修改</button></td>\
                        <td>\
                            <span class="through" data-sysId="' + list.sysId + '" data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "通过") + '</span>\
                            ' + (list.status >= 3 ? " " : "|") + '\
                            <span class="no-through" data-sysId="' + list.sysId + '"  data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "不通过") + '</span>\
                        </td>\
                        <td class="authority"><button class="stopProject  ' + hiddenBtn + ' " data-id="' + list.sysId + '">' + (list.status == 6 ? "开始" : list.status == 3 ? "暂停" : "") + '</button></td>>\
                    </tr>';
                            }
                            $("#index-main").html(html);
                            //赋值总页数
                            $("#pages").html(datas.totalPage);
                            pagg = Number($("#pages").html());
                            //调用分页插件修改查询总页数
                            $('#pagination0').jqPaginator('option', {
                                totalPages: pagg,
                            });

                            window.setTimeout(authorityFunc, 500);

                        },
                        error: function () {
                            console.log("发生错误");
                        }
                    });
                }
            });
            window.setTimeout(authorityFunc, 500);
        });

        //暂停项目点击事件
        $("#stop-task").click(function () {
            $("#status").text("6");
            $('#pagination0').jqPaginator({
                totalPages: 1,
                visiblePages: 5,
                currentPage: 1,
                first: '<li class="first"><a href="javascript:void(0);">首页</a></li>',
                prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
                next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
                last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
                page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
                onPageChange: function (num) {
                    $('#text').html('当前第' + num + '页');
                    //获取状态值
                    var status = $("#status").text();
                    var val = $("#search-input").val();
                    $.ajax({
                        type: "GET",
                        url: "/projectManger/query",
                        dataType: "json",
                        data: {page: num - 1, status: 6},
                        success: function (datas) {
                            console.log("暂停项目");
                            console.log(datas);
                            var html = "";
                            for (var i = 0; i < datas.list.length; i++) {
                                var list = datas.list[i];
                                var hiddenBtn = (list.status) == 3 ? '' : (list.status) == 6 ? '' : 'hidden';
                                html += '\
                                 <tr>\
                        <td style="display: none">' + list.sysId + '</td>\
                        <td>' + list.name + '</td>\
                        <td>' + list.resDept + '</td>\
                        <td>' + (list.resUser == undefined ? "" : list.resUser) + '</td>\
                        <td>' + (list.status == 2 ? "未审核" : list.status == 3 ? "审核通过" : list.status == 4 ? "项目已完成" : list.status == 6 ? "暂停" : "未确定") + '</td>\
                        <td class="lookNode">\
                            <a href="/projectManger/queryNode?sysId=' + list.sysId + '">查看项目</a>\
                        </td>\
                        <td class="authority"><button class="update-button" data-id="' + list.sysId + '" data-name="' + list.name + '" data-resDept="' + list.resDept + '" data-resUser="' + list.resUser + '" data-resPhone="' + list.resPhone + '" data-money="' + list.money + '" data-address="' + list.address + '" data-describes="' + list.describes + '" data-contactName="' + list.contactName + '" data-contactPhone="' + list.contactPhone + '" data-OwnerUnitPerson="' + list.ownerUnitPerson + '" data-OwnerUnitPersonPhone="' + list.ownerUnitPersonPhone + '" data-natureType="' + list.natureType + '" data-industryType="' + industryType + '" data-schedCode="' + schedCode + '" data-projectType="' + projectType + '" data-toggle="modal" data-target="#myModal-update" data-occupydept=' + list.occupyDept + ' data-occupyoperateuser=' + list.occupyOperateUser + ' data-occupyresuser=' + list.occupyResUser + ' data-occupyresuserphone=' + list.occupyResUserPhone + ' data-occupyoperateuserphone=' + list.occupyOperateUserPhone + '>修改</button></td>\
                        <td>\
                            <span class="through" data-sysId="' + list.sysId + '" data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "通过") + '</span>\
                            ' + (list.status >= 3 ? " " : "|") + '\
                            <span class="no-through" data-sysId="' + list.sysId + '"  data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "不通过") + '</span>\
                        </td>\
                        <td class="authority"><button class="stopProject  ' + hiddenBtn + ' " data-id="' + list.sysId + '">' + (list.status == 6 ? "开始" : list.status == 3 ? "暂停" : "") + '</button></td>>\
                    </tr>';
                            }
                            $("#index-main").html(html);
                            //赋值总页数
                            $("#pages").html(datas.totalPage);
                            pagg = Number($("#pages").html());
                            //调用分页插件修改查询总页数
                            $('#pagination0').jqPaginator('option', {
                                totalPages: pagg,
                            });
                            window.setTimeout(authorityFunc, 500);
                        },
                        error: function () {
                            console.log("发生错误");
                        }
                    });
                }
            });
            window.setTimeout(authorityFunc, 500);
        });

        /**
         * 搜索查询
         */
        $("#search").click(function () {
                $('#pagination0').jqPaginator({
                    totalPages: 1,
                    visiblePages: 5,
                    currentPage: 1,
                    first: '<li class="first"><a href="javascript:void(0);">首页</a></li>',
                    prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
                    next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
                    last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
                    page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
                    onPageChange: function (num) {
                        $('#text').html('当前第' + num + '页');
                        //获取状态值
                        var status = $("#status").text();
                        var name = $(".project-name1").val();
                        var resDept = $(".project-resdept1").val();
                        var resUser = $(".project-role1").val();
                        var resPhone = $(".project-rolePhone1").val();
                        var contactName = $(".contact-name1").val();
                        var contactPhone = $(".contact-phone1").val();
                        var OwnerUnitPerson = $(".OwnerUnit-person1").val();
                        var OwnerUnitPersonPhone = $(".OwnerUnit-personPhone1").val();
                        var address = $(".project-address1").val();
                        var money = $(".project-money1").val();
                        var describes = $(".project-describes1").val();
                        var natureType = $(".nature-type1").val();
                        var industryType = $("#industryType1  option:selected").val();
                        var schedCode = $("#schedCode1  option:selected").val();
                        var projectType = $("#projectType1  option:selected").val();
                        var occupyDept = $("#occupyDept1").val();
                        var occupyResUser = $("#occupyResUser1").val();
                        var occupyOperateUser = $("#occupyOperateUser1").val();
                        var occupyResUserPhone = $("#occupyResUserPhone1").val();
                        var occupyOperateUserPhone = $("#occupyOperateUserPhone1").val();
                        var filter = {
                            "name": name,
                            "resDept": resDept,
                            "resUser": resUser,
                            "resPhone": resPhone,
                            "contactName": contactName,
                            "contactPhone": contactPhone,
                            "ownerUnitPerson": OwnerUnitPerson,
                            "ownerUnitPersonPhone": OwnerUnitPersonPhone,
                            "money": money,
                            "address": address,
                            "describes": describes,
                            "natureType": natureType,
                            "industryType": industryType,
                            "schedCode": schedCode,
                            "projectType": projectType,
                            "occupyDept": occupyDept,
                            "occupyResUser": occupyResUser,
                            "occupyOperateUser": occupyOperateUser,
                            "occupyResUserPhone": occupyResUserPhone,
                            "occupyOperateUserPhone": occupyOperateUserPhone
                        }

                        $.ajax({
                            type: "POST",
                            url: "/projectManger/search",
                            dataType: "json",
                            data: JSON.stringify(filter),
                            contentType: 'application/json;charset=utf-8',
                            success: function (datas) {
                                var html = "";
                                for (var i = 0; i < datas.list.length; i++) {
                                    var list = datas.list[i];
                                    var hiddenBtn = (list.status) == 3 ? '' : (list.status) == 6 ? '' : 'hidden';
                                    html += '\
                                 <tr>\
                        <td style="display: none">' + list.sysId + '</td>\
                        <td>' + list.name + '</td>\
                        <td>' + list.resDept + '</td>\
                        <td>' + list.resUser + '</td>\
                        <td>' + (list.status == 2 ? "未审核" : list.status == 3 ? "审核通过" : list.status == 4 ? "项目已完成" : list.status == 6 ? "暂停" : "未确定") + '</td>\
                        <td class="lookNode">\
                            <a href="/projectManger/queryNode?sysId=' + list.sysId + '">查看项目</a>\
                        </td>\
                        <td class="authority"><button class="update-button" data-id="' + list.sysId + '" data-name="' + list.name + '" data-resDept="' + list.resDept + '" data-resUser="' + list.resUser + '" data-resPhone="' + list.resPhone + '" data-money="' + list.money + '" data-address="' + list.address + '" data-describes="' + list.describes + '" data-contactName="' + list.contactName + '" data-contactPhone="' + list.contactPhone + '" data-OwnerUnitPerson="' + list.ownerUnitPerson + '" data-OwnerUnitPersonPhone="' + list.ownerUnitPersonPhone + '" data-natureType="' + list.natureType + '" data-industryType="' + industryType + '" data-schedCode="' + schedCode + '" data-projectType="' + projectType + '" data-toggle="modal" data-target="#myModal-update" data-occupydept=' + list.occupyDept + ' data-occupyoperateuser=' + list.occupyOperateUser + ' data-occupyresuser=' + list.occupyResUser + ' data-occupyresuserphone=' + list.occupyResUserPhone + ' data-occupyoperateuserphone=' + list.occupyOperateUserPhone + '>修改</button></td>\
                        <td>\
                            <span class="through" data-sysId="' + list.sysId + '" data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "通过") + '</span>\
                            ' + (list.status >= 3 ? " " : "|") + '\
                            <span class="no-through" data-sysId="' + list.sysId + '"  data-toggle="modal" data-target="' + (list.status >= 3 ? " " : "#myModal") + '">' + (list.status >= 3 ? "---" : "不通过") + '</span>\
                        </td>\
                         <td class="authority"><button class="stopProject  ' + hiddenBtn + ' "   data-id="' + list.sysId + '">' + (list.status == 6 ? "开始" : list.status == 3 ? "暂停" : "") + '</button></td>>\
                    </tr>';
                                }
                                $("#index-main").html(html);
                                //赋值总页数
                                $("#pages").html(datas.totalPage);
                                pagg = Number($("#pages").html());
                                //调用分页插件修改查询总页数
                                $('#pagination0').jqPaginator('option', {
                                    totalPages: pagg,
                                });
                            },
                            error: function () {
                                console.log("发生错误");
                            }
                        });
                    }
                });
                $("#myModal-search").modal('hide');
                window.setTimeout(authorityFunc, 500);
            }
        );

        /**
         *
         * @param id 项目id
         * @param url 请求路径
         */
        function stopStart(id, url) {
            console.log(url);
            $.ajax({
                type: "POST",
                url: url,
                dataType: "json",
                data: JSON.stringify({sysId: id}),
                contentType: 'application/json;charset=UTF-8',
                success: function (data) {
                }
            });
        }

        $("#index-main").on("click", ".stopProject", function () {
            console.log(11);
            var text = $(this).text();//获取文本信息
            var sysid = $(this).data("id");
            var url = "";

            if (text == "暂停") {
                url = "/projectManger/pause";
                stopStart(sysid, url);
                $(this).text("开始");
                $(this).parent().prev().prev().prev().prev().text("暂停");
            } else if (text == "开始") {
                url = "/projectManger/start";
                stopStart(sysid, url);
                $(this).text("暂停");
                $(this).parent().prev().prev().prev().prev().text("审核通过");
            }
        });

        <%--确认通过不的显示或隐藏--%>
        $("#index-main").on("click", ".through", function () {

            var a = $(this).parent().prev().prev().html();
            $(".through-or-no-2").hide();
            $(".through-or-no-1").show();
            var lid = $(this).data("sysid"); //用户名
            $("#passY>form>input").val(lid);
        });

        $("#index-main").on("click", ".no-through", function () {
            $(".through-or-no-2").show();
            $(".through-or-no-1").hide();
            var lid = $(this).data("sysid"); //用户名
            $("#passN>form>input").val(lid);
        });

        $('#myModal-search').on('hidden.bs.modal', function () {
            $(':input', '#myModal-search').not(':button,:submit,:reset').val('').removeAttr('checked').removeAttr('checked');
        });

        window.setTimeout(authorityFunc, 500);

        //延时加载
        function authorityFunc() {
            //管理员权限
            if (branchType == "2") {
                //显示（搜索、导出督查任务）
                $(".authority").css("display", "inline");
            }
        }
    })

    function isEmpty(obj) {
        // 当数据是数组类型时
        if (obj instanceof Array) {
            if (obj == '' || obj == undefined || obj == null || obj == 'null') {
                return true;
            } else {
                return false;
            }
        } else {
            // 数据非数组
            if (obj === '' || obj == undefined || obj == null || obj == 'null' || obj == "undefined") {
                return true;
            } else {
                return false;
            }
        }
    }
</script>
</body>

</html>